#include "complex0.h"


complex::complex()
{
	this->A = 0;
	this->B = 0;
}
complex::complex(float A, float B)
{
	this->A = A;
	this->B = B;
}

complex complex::operator+(const complex& com)const
{
	return complex(this->A + com.A, this->B + com.B);
}
complex complex::operator-(const complex& com)const
{
	return complex(this->A - com.A, this->B - com.B);

}
complex complex::operator*(const complex& com)const
{
	return complex(this->A*com.A-this->B*com.B,this->A*com.B+this->B*com.A);

}
complex complex::operator*(int num)const
{
	return complex(this->A*num, this->B*num);
}
complex complex::operator~()const
{
	return complex(this->A,-this->B);
}

istream& operator>>(istream& is, complex& com)
{
	cout << "real:";
	is >> com.A;
	cout << "imginary:";
	is >> com.B;
	return is;
}
ostream& operator<<(ostream& os, const complex& com)
{
	os << "real:" << com.A << " imginary:" << com.B << endl;
	return os;
}